package com.dense.kuiniu.shelfcard.business;

import android.view.View;
import android.widget.TextView;

import com.dense.kuiniu.shelfcard.R;
import com.dense.kuiniu.shelfcard.base.BaseFragment;
import com.dense.kuiniu.shelfcard.utils.timer.CountDownView;
import com.dense.kuiniu.shelfcard.utils.timer.CounterController;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author Administrator
 * @date 2020/8/31
 */
public class PayChooseDelegate extends BaseFragment {
    public static PayChooseDelegate getInstance() {
        return new PayChooseDelegate();
    }

    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.count_down_view)
    CountDownView mCountDownView;

    @Override
    protected int getLayoutRes() {
        return R.layout.delegate_pay_choose;
    }

    @OnClick({R.id.tv_return, R.id.tv_alipay})
    public void onClick(View view) {
        super.onClick(view);
    }

    @Override
    public void onClick2(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.tv_return:
                exit();
                break;
            case R.id.tv_alipay:
                start(PayDelegate.getInstance());
                break;
        }
    }

    @Override
    protected void init() {
        mTvTitle.setText(R.string.text_amount_payment);
        mCountDownView.start(new CounterController.OnCompleteListener() {
            @Override
            public void onComplete() {
                exit();
            }
        });
    }

    private void exit() {
        pop();
    }
}